package executors.function;

import java.util.function.Function;

class Person {
  public String name;
  public Integer flag;
  
  Person(String name, Integer flag) {
    this.name = name;
    this.flag = flag;
  }
  
  Person() {
  }
}

class Man {
  public String name;
  public String sex;
  
  Man(String name, String sex) {
    this.name = name;
    this.sex = sex;
  }
  
  Man() {
  }
}


class FunctionTest implements Function<Person, Man> {
  
  @Override
  public Man apply(Person person) {
    String name = person.name;
    Integer flag = person.flag;
    return new Man(name, flag.equals(1) ? "男" : "女");
  }
}

public class Main03 {
  public static void main(String[] args) {
    FunctionTest functionTest = new FunctionTest();
    Man man = functionTest.apply(new Person("lihh", 1));
    System.out.println(man.name);
    System.out.println(man.sex);
  }
}
